<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Vuex严格模式</title>
</head>

<body>
  <div>
    <p>开启严格模式如果没有通过Mutation进行修改的话，会报错</p>
    <p>不要在生产模式下开启，会影响性能,因为严格模式会深度监测状态树来检测不合规的状态变更</p>
  </div>
  <script>
    //假设这是store.js文件
    export default new Vuex.Store({
      //开启严格模式,在开发环境
      /*  strict: true, */
      strict: process.env.NODE_ENV !== 'production',
      state: {
        count: 0,
        msg: 'Hello Vuex'
      },
      mutations: {},
      actions: {},
      modules: {}
    })
  </script>
</body>

</html>